/**
 * Created by Administrator on 2017/7/3.
 */
var vm_service = avalon.define({
    $id: "service",
    bannerArr: [],
    columnContent: [],
    columnTitle: [],
    autoplay: function () {
        setTimeout(function () {
            $('.single-item').slick({
                dots: true,
                autoplay: true,
                autoplaySpeed: 2000,
            });
        }, 300)
    }
})
 
getColumnId();
function getColumnId() {
    var pageId = getPageId('服务与支持');
    var columnIdArr = [];
    console.log('pageId=' + pageId);
    var _basePath = getCatelogUrl(pageId);
    console.log(_basePath);
    $.frontEngineAjax.ajaxRequest(function (data) {
        var tempOption;
        for (var i = 0, len = data.length; i < len; i++) {
            var id=0;
            if(i==0){
                id=data[i].number;
            }else{
                id=data[i].id;
            }
            var name = conformName(data[i].name);
            tempOption = {
                "name": name,
                "id": id
            }
            columnIdArr[i] = tempOption;
        }
        session_Storage("serviceColumnId", columnIdArr);
        console.log(columnIdArr);
        getColumnData(columnIdArr[0])
    }, _basePath)
}

var index = 0;
function getColumnData(columnIdArr) {
    var _basePath = getDataUrl(columnIdArr.id);
    console.log("getColumnData _basePath=" + _basePath);
    $.frontEngineAjax.ajaxRequest(function (data) {
        vm_service.columnContent.push(data[0]);
        console.log('data[0].length = ' + data.length)
        for (var i = 0, len = data.length; i < len; i++) {
            var tempImhUrl = data[i].imageUrl;
            vm_service.bannerArr.push(spliceImgUrl(tempImhUrl));
        }
        console.log('vm_service.bannerArr=' + vm_service.bannerArr)

    }, _basePath);
    console.log(vm_service.columnContent.length)
}
